﻿Imports Microsoft.VisualBasic
Imports System.Drawing
Imports System.Net

Namespace TwitterModel


    Partial Public Class Tweet
        Public ReadOnly Property UserAlias As String
            Get
                Dim _user = String.Empty
                If Not String.IsNullOrEmpty(Author) Then
                    _user = Me.Author.Split("(")(0).Trim
                End If
                Return _user
            End Get
        End Property
        Public ReadOnly Property UserName As String
            Get
                Dim _user = String.Empty
                If Not String.IsNullOrEmpty(Author) Then
                    _user = Me.Author.Split("(")(1).TrimEnd(")")
                End If
                Return _user
            End Get
        End Property

        Private _bitmap As Bitmap
        Public ReadOnly Property Bitmap As Bitmap
            Get
                If IsNothing(_bitmap) AndAlso Not String.IsNullOrEmpty(BitmapUrl) Then
                    Try
                        Dim request As WebRequest = WebRequest.Create(BitmapUrl)
                        Dim response As WebResponse = request.GetResponse
                        _bitmap = New Bitmap(response.GetResponseStream)
                    Catch ex As Exception

                    End Try
                End If
                Return _bitmap
            End Get
        End Property
    End Class

End Namespace